package org.amse.tanks.player;

import org.amse.tanks.model.Model;
import org.amse.tanks.objects.Direction;
import org.amse.tanks.objects.Tank;
import org.amse.tanks.view.UIViewConstants;

public class HumanPlayer implements Player, UIViewConstants {
    private Tank myTank;
    private Model myModel;

    public HumanPlayer(Model model, Tank tank) {
        myTank = tank;
        myModel = model;
        myModel.addTank(myTank);
    }

    public void getMove() {
    }
    
    public void getMove(String str) {
        if (str.contains(COMMAND_EXIT_CODE)) {
            System.exit(0);
        }
        if (str.contains(COMMAND_UP_CODE)) {
            myModel.moveTank(myTank.getId(), Direction.UP);
        }
        if (str.contains(COMMAND_LEFT_CODE)) {
            myModel.moveTank(myTank.getId(), Direction.LEFT);
        }
        if (str.contains(COMMAND_DOWN_CODE)) {
            myModel.moveTank(myTank.getId(), Direction.DOWN);
        }
        if (str.contains(COMMAND_RIGHT_CODE)) {
            myModel.moveTank(myTank.getId(), Direction.RIGHT);
        }
        if (str.contains(COMMAND_SHOOT_CODE)) {
            myModel.TankMakeShot(myTank.getId());
        }
    }
}
